import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
//引入vue3-tree-org组件
import vue3TreeOrg from 'vue3-tree-org';
import "vue3-tree-org/lib/vue3-tree-org.css";
// 引入自动生成的 SVG icon 注册脚本
import 'virtual:svg-icons-register'
//引入Elmessage和Elloading的css样式文件
import 'element-plus/theme-chalk/el-loading.css';
import 'element-plus/theme-chalk/el-message.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//引入vxe-table组件
import VxeUI from 'vxe-pc-ui'
import 'vxe-pc-ui/lib/style.css'
import VxeUITable from 'vxe-table'
import 'vxe-table/lib/style.css'
import VxeUIPluginExportXLSX from '@vxe-ui/plugin-export-xlsx'
import ExcelJS from 'exceljs'
//引入权限控制
import { setupPermissionDirective } from './directives/permission'
import { setLazyLoadDirective } from './directives/view'
const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
// 注册vue3-tree-org组件
app.use(vue3TreeOrg)
app.use(pinia)
app.use(router)
app.use(VxeUITable)
app.use(VxeUI)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// 全局指令
setupPermissionDirective(app)
setLazyLoadDirective(app)
VxeUI.use(VxeUIPluginExportXLSX, {
    ExcelJS
})
app.mount('#app')

if (process.env.NODE_ENV !== 'development') {
    console.log = function () { }
    console.error = function () { }
    console.warn = function () { }
    console.info = function () { }
    console.dir = function () { }
}